<?php
/**
 * list.phtml
 * 
 * @category    Madoqua
 * @package     Module
 * @subpackage  BlogAdmin
 */
?>

<div class="post-search">
    <?php $count = count($this->results); ?>
    
    <?php if ($count > 0) : ?>

    <div class="result-count">
        <?php echo $count; ?> post(s) found for "<?php echo $this->query; ?>"
    </div>
    
    <ul class="col1">
        <?php for($x = 0; $x < $count / 2; $x++) : ?>
        <?php $post = $this->results[$x]; ?>
        <li>
            <h3>
                <a href="<?php echo $this->url(array('controller' => 'post', 'action' => 'update', 'id' => $post->id), 'blog_admin', true); ?>">
                    <?php echo $post->title; ?>
                </a>
            </h3>
            <a href="<?php echo $this->url(array('controller' => 'post', 'action' => 'update', 'id' => $post->id), 'blog_admin', true); ?>">
                <span class="date">
                  <?php echo $this->date($post->posted); ?>
                </span>
            </a>
        </li>
        <?php endfor; ?>
    </ul>
    
    <ul class="col2">
        <?php for($x = (floor($count / 2)); $x < $count; $x++) : ?>
        <?php $post = $this->results[$x]; ?>
        <li>
            <h3>
                <a href="<?php echo $this->url(array('controller' => 'post', 'action' => 'update', 'id' => $post->id), 'blog_admin', true); ?>">
                    <?php echo $post->title; ?>
                </a>
            </h3>
            <a href="<?php echo $this->url(array('controller' => 'post', 'action' => 'update', 'id' => $post->id), 'blog_admin', true); ?>">
                <span class="date">
                  <?php echo $this->date($post->posted); ?>
                </span>
            </a>
        </li>
        <?php endfor; ?>
    </ul>
    
    <?php else: ?>
    <p>
        No posts found
    </p>
    
    <?php endif; ?>
</div>